MacApp versions 3.0a2 or earlier (including MacApp 2.0.1 and prior) have a bug when compiled with MPW 3.2. Due to some re-segmentation in the MPW Libraries, if you use a version of MacApp that has been compiled with MPW 3.2 you may notice some serious heap fragmentation in your MacApp applications. We noticed this bug when calling SetHandleSize (it promptly failed while attempting to grow the handle). The primary solution to the problem is to use MPW 3.1 when compiling MacApp version 2.0.1 or earlier.
If you REALLY need or want to use MPW 3.2 (for instance, if you're using MacApp 3.0a2), you must make the following modifications to your Basic Definitions (this workaround has not been thoroughly tested so... USE AT YOUR OWN RISK!):
SegmentMappings = ∂
#---- insert here
-sn PASLIB=Main ∂
-sn STDCLIB=Main ∂
#---- end of insertion
Modify the following declaration in your MacApp.r (in 3.0 this declaration will be found in Memory.r)
resource 'seg!' (kBaseMacApp,
#if qNames
"BaseMacApp",
#endif
purgeable) {
{ "Main";
"MAMain";
"GMain";
"GRes";
"GRes2";
"ARes";
"BBRes";
"BBRes2";
"%_MethTables";
"GError";
#---- insert here
"INTENV";
"SADEV";
"INTENV";
"STDIO";
"PASLIB";
"STDIO";
"STDCLIB";
#---- end of insertion
resource 'res!' (kBaseMacApp,
#if qNames
"BaseMacApp",
#endif
purgeable) {
{ "Main";
"MAMain";
"GMain";
"GRes";
"GRes2";
"ARes";
"BBRes";
"BBRes2";
"%_MethTables";
"GError";
#---- insert here
"INTENV";
"SADEV";
"INTENV";
"STDIO";
"PASLIB";
"STDIO";
"STDCLIB";
#---- end of insertion
One other possible solution would be to mark code resources produced by the libraries that were once in main as locked. Then, these segments would be loaded into memory and placed with the main segment, avoiding fragmentation problems. This can be done by modifying the user variable OtherLinkOptions in the Basic definitions file:
OtherLinkOptions = ∂
-ra PASLIB=resLocked ∂
-ra STDCLIB=resLocked
It would still be necessary to modify the SEG! resource as described above. Again, remember these fixes haven't been thoroughly tested, so use them at your own risk.